#ifndef __DBROLE_CREATE_FAILEDSENDER_H__
#define __DBROLE_CREATE_FAILEDSENDER_H__

#include "gwmessagemap.hpp"
#include "IMessageOperator.h"
#include "protonet.hpp"
#include "netlib.h"
#include "../DBServer.h"
#include "dbserver.pb.h"
#include "../../Sender/DBServerSender.h"

/**
*@file       DBRole_Create_FailedSender.h
*@brief      send message DBRole_Create_Failed
*
*@author     graywind
*@version    1.0.0.0
*@data       2012/3/28
*/

///message wrapper
class msgDBRole_Create_Failed
{
public:
    static const int MessageId = DBRole_Create_Failed;
    //TODO
    pnSessionHandle  SessionId;
    CreateRoleFailed MsgContent;
    ///@brief   constructor
    msgDBRole_Create_Failed(int session_id, int login_code, CreateRoleFailed::eErrorCode error):
    SessionId(session_id)
    {
        MsgContent.set_errorcode(error);
        MsgContent.set_logincode(login_code);
    }
};

class HandleDBRole_Create_Failed
{
public:
    ///@brief     handle message
    ///param[in]  msg     message wrapper of DBRole_Create_Failed
    ///retval     void
    static void HandleMessage(msgDBRole_Create_Failed* msg)
    {
        //TODO
        //Main Message:  msgDBServer
        msgDBServer mainMsg(msg->SessionId, msgDBRole_Create_Failed::MessageId, ProtoNet<CreateRoleFailed>::IntoBytes(msg->MsgContent));
        gwMessagePort::ProcessMessage(&mainMsg);
    }
};
///[message wrapper]  [handler]
RegisterHandler(msgDBRole_Create_Failed, HandleDBRole_Create_Failed);

#endif
